<?php

namespace app\model;

use app\traits\ModelTrait;
use think\Model;
use think\model\relation\HasOne;

class Banner extends Model
{
    use ModelTrait;

    public array $notes = [
        'status'    => [
            1 => '显示',
            2 => '隐藏',
        ],
        'is_del'    => [
            1 => '正常',
            2 => '删除',
        ],
        'item_type' => [
            1 => '打开此轮播图',
            2 => '打开视频',
            3 => '打开会员卡详情页',
            4 => '打开产品详情页',
            5 => '打开花艺视频详情页',
            6 => '打开文章详情页',
        ],
    ];

    public function tagInfo(): HasOne
    {
        return $this->hasOne(Tag::class, 'id', 'tag_id')->where('type', 3)->where('status', 1)->field('id,name');
    }

}